package com.example.demo.service.impl;


import com.example.demo.dao.CommentDao;
import com.example.demo.model.Comment;
import com.example.demo.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentDao commentDao;

    @Override
    public void add(Comment comment) {
        commentDao.insertSelective(comment);
    }

    @Override
    public List<Comment> selectByDishId(Long dishId) {
        List<Comment> comments = commentDao.selectByDishId(dishId);
        return comments;
    }

    @Override
    public List<Comment> selectAllComments() {
        List<Comment> comments = commentDao.findAll();
        return comments;
    }
}
